<?php
/**
 * @link https://www.kancloud.cn/cleverstone/ymb2
 * @copyright Copyright (c) 2020 Yii Manager Software LLC
 */

namespace extend\kdniao;

/**
 * 头部定义
 */
final class Header
{
    /**
     * @var string[] 普通物流状态标签
     */
    public static $stateLabel = [
        'None' => '无轨迹',
        '0' => '暂无轨迹信息',
        '1' => '已揽收',
        '2' => '在途中',
        '3' => '已签收',
        '4' => '问题件',
        '5' => '转寄',
        '6' => '清关',
    ];
    /**
     * @var string[] 增值物流状态标签
     */
    public static $stateExLabel = [
        'None' => '无轨迹',
        '0' => '暂无轨迹信息',
        '1' => '已揽收',
        '2' => '在途中',
            '201' => '到达派件城市',
            '202' => '派件中',
            '204'=> '到达转运中心',
            '205'=> '到达派件网点',
            '206'=> '寄件网点发件',
            '211' => '已放入快递柜或驿站',
        '3' => '已签收',
            '301' => '正常签收',
            '302' => '派件异常后最终签收',
            '304' => '代收签收',
            '311' => '快递柜或驿站签收',
        '4' => '问题件',
            '401' => '发货无信息',
            '402' => '超时未签收',
            '403' => '超时未更新',
            '404' => '拒收(退件)',
            '405' => '派件异常',
            '406' => '退货签收',
            '407' => '退货未签收',
            '412' => '快递柜或驿站超时未取',
            '413' => '单号已拦截',
            '414' => '破损',
            '415' => '客户取消发货',
            '416' => '无法联系',
            '417' => '配送延迟',
            '418' => '快件取出',
            '419' => '重新派送',
            '420' => '收货地址不详细',
            '421' => '收件人电话错误',
            '422' => '错分件',
            '423' => '超区件',
        '5' => '转寄',
        '6' => '清关',
            '601' => '待清关',
            '602' => '清关中',
            '603' => '已清关',
            '604' => '清关异常',
        '10' => '待揽件',
    ];

    /**
     * 是否已签收
     * @param string $status 快递状态
     * @return bool
     */
    public static function isSignFor($status)
    {
        return $status == '3';
    }

    /**
     * 获取增值物流状态标签
     * @param integer $statusEx 增值物流状态
     * @return string
     */
    public static function getStatusExLabel($statusEx)
    {
        return self::$stateExLabel[$statusEx] ?? '未知状态';
    }

    /**
     * 获取普通物流状态标签
     * @param integer $status 普通物流状态
     * @return string
     */
    public static function getStatusLabel($status)
    {
        return self::$stateLabel[$status] ?? '未知状态';
    }
}